package test01;

public class test2_Thread {
    public static void main(String[] args) throws InterruptedException {
        Mythred mythred = new Mythred();
        //开启线程
        mythred.start();
        //main方法中的循环
        while (true) {
            Thread.sleep(1000);
            System.out.println("同时进行");
        }
    }

    static class Mythred extends Thread {
        @Override
        public void run() {
            while (true) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("测试");
            }
        }
    }
}
